home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9425 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: redstone.interpath.net!mercury!softbase
  2. From: softbase@mercury.interpath.net (Scott McMahan - Softbase Systems)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: API's
  5. Date: 1 Mar 1996 17:40:06 GMT
  6. Organization: Interpath -- Providing Internet access to North Carolina
  7. Message-ID: <4h7cpm$ojd@news.interpath.net>
  8. References: <BMagnusson-2802961627410001@204.118.152.122>
  9. NNTP-Posting-Host: mercury.interpath.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Baiss E. Magnusson (BMagnusson@PrecisionImages.com) wrote:
  13.  
  14. : Does anyone know why it is a good/bad idea to use a variable number of
  15. : parameters in C function calls which are part of an API?
  16.  
  17. Good:
  18.  
  19.     1. You're constrained by design decisions. I wrote a library
  20.     that had to be interface-compatible with another library
  21.     from the dim, dark past. Varargs were mandatory to keep
  22.     the call format the same. No choice at all!
  23.  
  24. Bad:
  25.  
  26.     1. The design decisions were bad to begin with. 
  27.  
  28.     2. It's confusing to users of the library, because you
  29.     call the same function different ways.
  30.  
  31. The argument that you can't control what's being passed is a little
  32. bogus. You can't validate pointers passed in from a COBOL, C, 
  33. Pascal, etc program to begin with. You have to accept what they
  34. pass you on blind faith whether it's a documented parameter
  35. or a varargs parameter.
  36.  
  37. Scott
  38.  
  39.  
  40.  
  41.  
  42.